import { requestClient } from '#/api/request';

export namespace CodeFileApi {
  export interface CodeFile {
    fileName: string;
    code: string;
    description: string;
    createUser: string;
    createdUserID: string;
  }
}
const saveCodeFile = (codeFile: CodeFileApi.CodeFile) => {
  return requestClient.post('/dsc-systemMS/dsc-code-file/save', codeFile);
};

const initFileList = (userId: string) => {
  return requestClient.get(`/dsc-systemMS/dsc-code-file/getFileList/${userId}`);
};

const deletCodeFile = (fileId: string) => {
  return requestClient.delete(`/dsc-systemMS/dsc-code-file/delete/${fileId}`);
};

const renameCodeFile = (id: any, newFileName: any) => {
  return requestClient.post(
    `/dsc-systemMS/dsc-code-file/rename?id=${id}&newFileName=${newFileName}`,
  );
};
export default {
  saveCodeFile,
  initFileList,
  deletCodeFile,
  renameCodeFile,
};
